import cv2
import numpy as np

img = cv2.imread("../images/bgc.jpeg")
logo1 = cv2.imread("../images/tm1.png")
h1, w1, _ = logo1.shape
logo2 = cv2.imread("../images/tm2.png")
h2, w2, _ = logo2.shape

logo1_gray = cv2.cvtColor(logo1, cv2.COLOR_BGR2GRAY)
logo2_gray = cv2.cvtColor(logo2, cv2.COLOR_BGR2GRAY)

_, logo1_binary = cv2.threshold(logo1_gray, 0, 255, cv2.THRESH_BINARY_INV)
_, logo2_binary = cv2.threshold(logo2_gray, 0, 255, cv2.THRESH_BINARY_INV)

ROI1 = img[10:h1+10, 10:w1+10]
ROI2 = img[10:h2+10, 390:w2+390]

ROI1_bitadd_img = cv2.bitwise_and(ROI1, ROI1, mask=logo1_binary)
ROI2_bitadd_img = cv2.bitwise_and(ROI2, ROI2, mask=logo2_binary)

logo1_and_ROI1 = cv2.add(ROI1_bitadd_img, logo1)
logo2_and_ROI2 = cv2.add(ROI2_bitadd_img, logo2)

img[10:h1+10, 10:w1+10] = logo1_and_ROI1
img[10:h2+10, 390:w2+390] = logo2_and_ROI2
cv2.imshow("img", img)
cv2.waitKey(0)